package binTree;
//98. 验证二叉搜索树
public class Num98_isValidBST {
    public boolean isValidBST(TreeNode root) {
        return isValidBST(root,Long.MIN_VALUE , Long.MAX_VALUE);
    }
    public boolean isValidBST(TreeNode node, long lower, long upper) {
        if (node == null)return true;
        if (node.val >= upper || node.val <= lower)return false;
        return isValidBST(node.left , lower , node.val) && isValidBST(node.right , node.val, upper);

    }
}
